home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / bovinated-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  5.1 KB  |  140 lines

  1. ; GIMP - The GNU Image Manipulation Program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; This program is free software: you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 3 of the License, or
  7. ; (at your option) any later version.
  8. ;
  9. ; This program is distributed in the hope that it will be useful,
  10. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ; GNU General Public License for more details.
  13. ;
  14. ; You should have received a copy of the GNU General Public License
  15. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. ;
  17. ;  Bovinated Logos v0.1 04/08/98
  18. ;  by Brian McFee <keebler@wco.com>
  19. ;  Creates Cow-spotted logs.. what else?
  20.  
  21. (define (apply-bovinated-logo-effect img
  22.                                      logo-layer
  23.                                      spots-x
  24.                                      spots-y
  25.                                      bg-color)
  26.   (let* (
  27.         (width (car (gimp-drawable-width logo-layer)))
  28.         (height (car (gimp-drawable-height logo-layer)))
  29.         (bg-layer (car (gimp-layer-new img
  30.                                        width height RGBA-IMAGE
  31.                                        "Background" 100 NORMAL-MODE)))
  32.         (blur-layer (car (gimp-layer-new img
  33.                                          width height RGBA-IMAGE
  34.                                          "Blur" 100 NORMAL-MODE)))
  35.         )
  36.  
  37.     (gimp-context-push)
  38.  
  39.     (script-fu-util-image-resize-from-layer img logo-layer)
  40.     (script-fu-util-image-add-layers img blur-layer bg-layer)
  41.  
  42.     (gimp-selection-all img)
  43.     (gimp-context-set-background bg-color)
  44.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  45.     (gimp-selection-none img)
  46.  
  47.     (gimp-layer-set-lock-alpha blur-layer TRUE)
  48.     (gimp-context-set-background '(255 255 255))
  49.     (gimp-selection-all img)
  50.     (gimp-edit-fill blur-layer BACKGROUND-FILL)
  51.     (gimp-edit-clear blur-layer)
  52.     (gimp-context-set-background '(191 191 191))
  53.     (gimp-selection-none img)
  54.     (gimp-layer-set-lock-alpha blur-layer FALSE)
  55.     (gimp-selection-layer-alpha logo-layer)
  56.     (gimp-edit-fill blur-layer BACKGROUND-FILL)
  57.     (plug-in-gauss-rle RUN-NONINTERACTIVE img blur-layer 5.0 1 1)
  58.     (gimp-selection-none img)
  59.     (gimp-layer-set-lock-alpha logo-layer TRUE)
  60.     (gimp-selection-all img)
  61.     (plug-in-solid-noise RUN-NONINTERACTIVE img logo-layer 0 0 23 1 spots-x spots-y)
  62.     (gimp-brightness-contrast logo-layer 0 127)
  63.     (gimp-selection-none img)
  64.     (gimp-layer-set-lock-alpha logo-layer FALSE)
  65.     (plug-in-bump-map RUN-NONINTERACTIVE img logo-layer blur-layer
  66.                       135 50 10 0 0 0 30 TRUE FALSE 0)
  67.     (gimp-layer-set-offsets blur-layer 5 5)
  68.     (gimp-invert blur-layer)
  69.     (gimp-layer-set-opacity blur-layer 50.0)
  70.     (gimp-image-set-active-layer img logo-layer)
  71.  
  72.     (gimp-context-pop)
  73.   )
  74. )
  75.  
  76. (define (script-fu-bovinated-logo-alpha img
  77.                                         logo-layer
  78.                                         spots-x
  79.                                         spots-y
  80.                                         bg-color)
  81.   (begin
  82.     (gimp-image-undo-group-start img)
  83.     (apply-bovinated-logo-effect img logo-layer spots-x spots-y bg-color)
  84.     (gimp-image-undo-group-end img)
  85.     (gimp-displays-flush)
  86.   )
  87. )
  88.  
  89. (script-fu-register "script-fu-bovinated-logo-alpha"
  90.   _"Bo_vination..."
  91.   _"Add 'cow spots' to the selected region (or alpha)"
  92.   "Brian McFee <keebler@wco.com>"
  93.   "Brian McFee"
  94.   "April 1998"
  95.   "RGBA"
  96.   SF-IMAGE      "Image"             0
  97.   SF-DRAWABLE   "Drawable"          0
  98.   SF-ADJUSTMENT _"Spots density X"  '(16 1 16 1 10 0 1)
  99.   SF-ADJUSTMENT _"Spots density Y"  '(4 1 16 1 10 0 1)
  100.   SF-COLOR      _"Background Color" "white"
  101. )
  102.  
  103. (script-fu-menu-register "script-fu-bovinated-logo-alpha"
  104.                          "<Image>/Filters/Alpha to Logo")
  105.  
  106.  
  107. (define (script-fu-bovinated-logo text
  108.                                   size
  109.                                   font
  110.                                   spots-x
  111.                                   spots-y
  112.                                   bg-color)
  113.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  114.          (border (/ size 4))
  115.          (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
  116.     (gimp-image-undo-disable img)
  117.     (apply-bovinated-logo-effect img text-layer spots-x spots-y bg-color)
  118.     (gimp-image-undo-enable img)
  119.     (gimp-display-new img)
  120.   )
  121. )
  122.  
  123. (script-fu-register "script-fu-bovinated-logo"
  124.   _"Bo_vination..."
  125.   _"Create a logo with text in the style of 'cow spots'"
  126.   "Brian McFee <keebler@wco.com>"
  127.   "Brian McFee"
  128.   "April 1998"
  129.   ""
  130.   SF-STRING     _"Text"               "Fear the Cow"
  131.   SF-ADJUSTMENT _"Font size (pixels)" '(80 2 1000 1 10 0 1)
  132.   SF-FONT       _"Font"               "RoostHeavy"
  133.   SF-ADJUSTMENT _"Spots density X"    '(16 1 16 1 10 0 1)
  134.   SF-ADJUSTMENT _"Spots density Y"    '(4 1 16 1 10 0 1)
  135.   SF-COLOR      _"Background color"   "white"
  136. )
  137.  
  138. (script-fu-menu-register "script-fu-bovinated-logo"
  139.                          "<Image>/File/Create/Logos")
  140.